import React, { useState } from "react";
import { Collapse } from "antd";


 function noticeCollapse( dataList) {
    const { Panel } = Collapse;

    let [key, setKey] = useState([]);//声明了一个状态key用来存储展开的面板

    function handleKeyChange(e) {//实现Collapse自带的onChange方法
        // changeKeys(false);//触发面板的onChange时设置父组件的show为false，即此时activeKey的值为key
        // setKey(e);存储当前点开的面板值到key中
    }

    return (
        <Collapse
           // expandIconPosition="right"
            //activeKey={keys ? [] : key}//如果keys为true设置面板展开数量为空，即都折叠
            onChange={handleKeyChange}
        >
            {dataList && dataList.length > 0
                ? dataList.map(item => (
                    <Panel
                        header={item}
                        key={item}
                    >
                        <div>test</div>
                    </Panel>
                ))
                : ""}
        </Collapse>
    );
}

export {noticeCollapse}
